import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:kunlun_gas/app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    BindBlueToothViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '绑定读卡器'),
    body: MyInkWellWidget(
      child: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              color: ThemeConfig.mainColor,
              height: 100,
              width: double.infinity,
              padding: EdgeInsets.symmetric(horizontal: 15, vertical: 25),
              child: Container(
                width: double.infinity,
                height: 50,
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.all(Radius.circular(4)),
                ),
                child: Row(
                  children: [
                    Padding(
                      padding: EdgeInsets.only(left: 20, right: 20),
                      child: Image.asset('images/icon_ic.png'),
                    ),
                    Container(
                      width: 0.5,
                      height: 24,
                      color: Color(0xffC2C2C2),
                      margin: EdgeInsets.only(right: 15),
                    ),
                    Expanded(
                      child: TextField(
                        style: TextThemeConfig.Font14WithColor22,
                        controller: state.numberController,
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          hintText: "请输入读卡器设备号",
                          hintStyle: TextThemeConfig.Font14WithColor99,
                          contentPadding: EdgeInsets.only(),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Padding(
              padding: EdgeInsets.only(top: 20, bottom: 20),
              child: Image.asset('images/ic_bind.png'),
            ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 40),
              child: Text(
                '提示：请输入蓝牙读卡器背面的设备号，进行绑定',
                style: TextThemeConfig.Font14WithColor99,
              ),
            ),
            Container(
              margin: EdgeInsets.symmetric(
                horizontal: 15,
                vertical: 30,
              ),
              height: 50,
              width: double.infinity,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(4)),
                color: ThemeConfig.mainColor,
              ),
              child: MyInkWellWidget(
                child: Center(
                  child: Padding(
                    padding: EdgeInsets.only(bottom: 1),
                    child: Text(
                      '立即绑定',
                      style: TextThemeConfig.Font16WithWhite,
                    ),
                  ),
                ),
                onTap: () =>
                    dispatch(BindBlueToothViewActionCreator.onSubmit()),
              ),
            ),
          ],
        ),
      ),
      onTap: () => CommonUtils.closeKey(viewService.context),
    ),
  );
}
